<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="初识SpringBoot配置, 凌">
    <meta name="description" content="">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>初识SpringBoot配置 | 凌</title>
    <link rel="icon" type="image/png" href="/blog/favicon.png">

    <link rel="stylesheet" type="text/css" href="https://sky508.gitee.io/blog/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="https://sky508.gitee.io/blog/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="https://sky508.gitee.io/blog/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="https://sky508.gitee.io/blog/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="https://sky508.gitee.io/blog/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/blog/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/blog/css/my.css">

    <script src="https://sky508.gitee.io/blog/libs/jquery/jquery.min.js"></script>

<meta name="generator" content="Hexo 4.2.0"><link rel="stylesheet" href="/blog/css/prism.css" type="text/css">
<link rel="stylesheet" href="/blog/css/prism-line-numbers.css" type="text/css"></head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/blog/" class="waves-effect waves-light">
                    
                    <img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/banner/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">凌</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/blog/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/blog/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/blog/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/blog/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/blog/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>联系</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/banner/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">凌</div>
        <div class="logo-desc">
            
            Never really desperate, only the lost of the soul.
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/blog/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/blog/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/blog/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/blog/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/blog/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			联系
		</a>
          
        </li>
        
        
    </ul>
</div>


        </div>

        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/7.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">初识SpringBoot配置</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="https://sky508.gitee.io/blog/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        height: calc(100vh - 250px);
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/blog/tags/SpringBoot/">
                                <span class="chip bg-color">SpringBoot</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/blog/categories/%E5%90%8E%E7%AB%AF%E6%A1%86%E6%9E%B6/" class="post-category">
                                后端框架
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2020-02-15
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2020-05-22
                </div>
                

                

                

                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>
        </div>
        <hr class="clearfix">
        <div class="card-content article-card-content">
            <div id="articleContent">
                <h3 id="１、-Value的使用"><a href="#１、-Value的使用" class="headerlink" title="１、@Value的使用"></a>１、@Value的使用</h3><p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/@Value.png" alt=""></p>
<h3 id="2、Value获取值和-ConfigurationProperties获取值比较"><a href="#2、Value获取值和-ConfigurationProperties获取值比较" class="headerlink" title="2、Value获取值和@ConfigurationProperties获取值比较"></a>2、Value获取值和@ConfigurationProperties获取值比较</h3><table>
<thead>
<tr>
<th></th>
<th>@ConfigurationProperties</th>
<th>@Value</th>
</tr>
</thead>
<tbody><tr>
<td>功能</td>
<td>批量注入配置文件的属性</td>
<td>一个个的指定</td>
</tr>
<tr>
<td>松散绑定（松散语法）</td>
<td>支持</td>
<td>不支持</td>
</tr>
<tr>
<td>SpEL</td>
<td>不支持</td>
<td>支持</td>
</tr>
<tr>
<td>JSR303数据校验(@Validated)</td>
<td>支持</td>
<td>不支持</td>
</tr>
<tr>
<td>复杂类型封装</td>
<td>支持</td>
<td>不支持</td>
</tr>
</tbody></table>
<p>注意:  JSR303数据校验(@Validated)</p>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/JSR303%E6%95%B0%E6%8D%AE%E6%A0%A1%E9%AA%8C.png" alt=""></p>
<p>配置文件yml还是properties他们都能获取到值，</p>
<p>如果我们只是在某个业务逻辑中获取配置文件中<strong>某项值</strong>，使用@Value</p>
<p>如果我们专门编写了一个javaBean来和配置文件中进行映射，那我们就直接使用@ConfigurationProperties</p>
<h3 id="3、置文件注入值数据校验"><a href="#3、置文件注入值数据校验" class="headerlink" title="3、置文件注入值数据校验"></a>3、置文件注入值数据校验</h3><pre class="line-numbers language-java"><code class="language-java"><span class="token annotation punctuation">@Component</span>
<span class="token annotation punctuation">@ConfigurationProperties</span><span class="token punctuation">(</span>prefix <span class="token operator">=</span> <span class="token string">"person"</span><span class="token punctuation">)</span>
<span class="token annotation punctuation">@Validated</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Person</span> <span class="token punctuation">{</span>

<span class="token comment" spellcheck="true">//    @Value("${person.name}")</span>

    <span class="token comment" spellcheck="true">//添加了 @Email，name必须是邮箱格式</span>
    <span class="token annotation punctuation">@Email</span>
    <span class="token keyword">private</span> String name<span class="token punctuation">;</span>

<span class="token comment" spellcheck="true">//    @Value("#{11*2}")</span>
    <span class="token keyword">private</span> Integer age<span class="token punctuation">;</span>

<span class="token comment" spellcheck="true">//    @Value("true")</span>
    <span class="token keyword">private</span> Boolean online<span class="token punctuation">;</span>
    <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h3 id="4、-PropertySource-amp-ImportResource"><a href="#4、-PropertySource-amp-ImportResource" class="headerlink" title="4、@PropertySource &amp; @ImportResource"></a>4、@PropertySource &amp; @ImportResource</h3><p>4.1 @<strong>PropertySource</strong>:　加载指定的配置文件；</p>
<pre class="line-numbers language-java"><code class="language-java"><span class="token annotation punctuation">@Component</span>
<span class="token annotation punctuation">@ConfigurationProperties</span><span class="token punctuation">(</span>prefix <span class="token operator">=</span> <span class="token string">"person"</span><span class="token punctuation">)</span>
<span class="token annotation punctuation">@PropertySource</span><span class="token punctuation">(</span>value <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token string">"classpath:person.properties"</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment" spellcheck="true">//@Validated</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Person</span> <span class="token punctuation">{</span>

    <span class="token comment" spellcheck="true">//添加了 @Email，name必须是邮箱格式</span>
   <span class="token comment" spellcheck="true">// @Email</span>
    <span class="token comment" spellcheck="true">//    @Value("${person.name}")</span>
    <span class="token keyword">private</span> String name<span class="token punctuation">;</span>

<span class="token comment" spellcheck="true">//    @Value("#{11*2}")</span>
    <span class="token keyword">private</span> Integer age<span class="token punctuation">;</span>

<span class="token comment" spellcheck="true">//    @Value("true")</span>
    <span class="token keyword">private</span> Boolean online<span class="token punctuation">;</span>

    <span class="token keyword">private</span> Date date<span class="token punctuation">;</span>

   <span class="token comment" spellcheck="true">// @Value("${person.maps}")使用不了</span>
    <span class="token keyword">private</span> Map<span class="token operator">&lt;</span>String<span class="token punctuation">,</span> Object<span class="token operator">></span> maps<span class="token punctuation">;</span>

    <span class="token keyword">private</span> List<span class="token operator">&lt;</span>Object<span class="token operator">></span> lists<span class="token punctuation">;</span>

    <span class="token keyword">private</span> Dog dog<span class="token punctuation">;</span>
    <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>4.2 @<strong>ImportResource</strong>:  导入Spring的配置文件，让配置文件里面的内容生效；</p>
<p>​        Spring Boot里面没有Spring的配置文件，我们自己编写的配置文件，也不能自动识别。想让Spring的配置文件生效，加载进来；@<strong>ImportResource</strong>标注在一个配置类上。</p>
<p>不去编写Spring的编写文件，采用纯注解的方式</p>
<pre class="line-numbers language-xml"><code class="language-xml"><span class="token prolog">&lt;?xml version="1.0" encoding="UTF-8"?></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>beans</span> <span class="token attr-name">xmlns</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.springframework.org/schema/beans<span class="token punctuation">"</span></span>
       <span class="token attr-name"><span class="token namespace">xmlns:</span>xsi</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.w3.org/2001/XMLSchema-instance<span class="token punctuation">"</span></span>
       <span class="token attr-name"><span class="token namespace">xsi:</span>schemaLocation</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>

    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>bean</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>helloService<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>team.glh.demo.springboottest.service.HelloService<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>bean</span><span class="token punctuation">></span></span>

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>beans</span><span class="token punctuation">></span></span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p><strong>SpringBoot推荐给容器中添加组件的方式</strong>：推荐使用纯注解的方式</p>
<p>１、配置类===== Spring配置文件</p>
<p>2、使用@Bean给容器添加组件</p>
<pre class="line-numbers language-java"><code class="language-java"><span class="token comment" spellcheck="true">/**
 * @Author: Gan LingHao
 * @Date: Created in 上午11:32 2020/2/4
 * @todo: @Configuration指明当前类为配置类，就是来替代之前的Spring的配置文件
 *         在配置文件中用&lt;bean>&lt;/bean>标签添加组件
 */</span>
<span class="token annotation punctuation">@Slf4j</span>
<span class="token annotation punctuation">@Configuration</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">MyAppConfig</span> <span class="token punctuation">{</span>

    <span class="token comment" spellcheck="true">/**
     * 将方法的返回值添加到容器中，容器中这个组件默认的id为方法名
     * @return
     */</span>
    <span class="token annotation punctuation">@Bean</span>
    <span class="token keyword">public</span> HelloService <span class="token function">helloService2</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>

        log<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">"注解@Bean给容器中添加了组件"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> <span class="token keyword">new</span> <span class="token class-name">HelloService</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h3 id="5-配置文件占位符"><a href="#5-配置文件占位符" class="headerlink" title="5.　配置文件占位符"></a>5.　配置文件占位符</h3><p>１．随机数</p>
<pre class="line-numbers language-java"><code class="language-java">$<span class="token punctuation">{</span>random<span class="token punctuation">.</span>uuid<span class="token punctuation">}</span>、$<span class="token punctuation">{</span>random<span class="token punctuation">.</span>value<span class="token punctuation">}</span>、$<span class="token punctuation">{</span>random<span class="token punctuation">.</span><span class="token keyword">int</span><span class="token punctuation">}</span>、$<span class="token punctuation">{</span>random<span class="token punctuation">.</span><span class="token keyword">long</span><span class="token punctuation">}</span>、$<span class="token punctuation">{</span>random<span class="token punctuation">.</span><span class="token keyword">int</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">}</span>、$<span class="token punctuation">{</span>random<span class="token punctuation">.</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token number">1024</span><span class="token punctuation">,</span><span class="token number">65536</span><span class="token punctuation">]</span><span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>２．占位符获取之前配置的值，如果没有可以使用：指定默认值；</p>
<pre class="line-numbers language-properties"><code class="language-properties"><span class="token attr-name">person.name</span><span class="token punctuation">=</span><span class="token attr-value">李四${random.uuid}</span>
<span class="token attr-name">person.age</span><span class="token punctuation">=</span><span class="token attr-value">${random.int}</span>
<span class="token attr-name">person.online</span><span class="token punctuation">=</span><span class="token attr-value">false</span>
<span class="token attr-name">person.date</span><span class="token punctuation">=</span><span class="token attr-value">2020/2/2</span>
<span class="token attr-name">person.maps.k1</span><span class="token punctuation">=</span><span class="token attr-value">v1</span>
<span class="token attr-name">person.maps.k2</span><span class="token punctuation">=</span><span class="token attr-value">vv2</span>
<span class="token attr-name">person.lists</span><span class="token punctuation">=</span><span class="token attr-value">lili,sssddd,jj99</span>
<span class="token comment" spellcheck="true">#${person.name2:xxxx}可以给没有的属性name2赋值xxxx</span>
<span class="token attr-name">person.dog.name</span><span class="token punctuation">=</span><span class="token attr-value">哈士奇 is ${person.name2:xxxx}'s　dog</span>
<span class="token attr-name">person.dog.number</span><span class="token punctuation">=</span><span class="token attr-value">10001</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h3 id="6、Profile"><a href="#6、Profile" class="headerlink" title="6、Profile"></a>6、Profile</h3><h4 id="5-1-多Profile文件"><a href="#5-1-多Profile文件" class="headerlink" title="5.1.多Profile文件"></a><strong>5.1.多Profile文件</strong></h4><p>我们在主配置文件编写的时候，文件名可以是　application-{profile}.properties/yml</p>
<p>默认使用application.properties的配置；</p>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/profiles-1.png" alt=""></p>
<h4 id="5-2-yml支持多文档方式"><a href="#5-2-yml支持多文档方式" class="headerlink" title="5.2.yml支持多文档方式"></a>5.2.yml支持多文档方式</h4><p>yaml使用—进行document进行分割</p>
<pre class="line-numbers language-yaml"><code class="language-yaml"><span class="token key atrule">server</span><span class="token punctuation">:</span>
  <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8081</span>
<span class="token key atrule">spring</span><span class="token punctuation">:</span>
  <span class="token key atrule">profiles</span><span class="token punctuation">:</span>
    <span class="token key atrule">active</span><span class="token punctuation">:</span> prod
<span class="token punctuation">---</span>
<span class="token key atrule">server</span><span class="token punctuation">:</span>
  <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8082</span>
<span class="token key atrule">spring</span><span class="token punctuation">:</span>
  <span class="token key atrule">profiles</span><span class="token punctuation">:</span> dev
<span class="token punctuation">---</span>
<span class="token key atrule">server</span><span class="token punctuation">:</span>
  <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8083</span>
<span class="token key atrule">spring</span><span class="token punctuation">:</span>
    <span class="token key atrule">profiles</span><span class="token punctuation">:</span> prod<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h4 id="5-3-激活指定Profile"><a href="#5-3-激活指定Profile" class="headerlink" title="5.3.激活指定Profile"></a>5.3.激活指定Profile</h4><p> 1.在配置文件中指定 spring.profiles.active=dev</p>
<p>2.命令配置：</p>
<p>方法一：<strong>在idea中直接进行配置</strong>命令行参数：–spring.profiles.active=dev</p>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/profiles-2.png" alt=""></p>
<p>方法二：<strong>在idea中直接进行配置</strong>虚拟机参数：-Dspring.profiles.active=dev            </p>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/profiles-4.png" alt=""></p>
<p>方法三：　<strong>在终端使用运行打包后的应用</strong>：        <img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/profiles-3.png" alt=""></p>
<h3 id="7、配置文件加载位置"><a href="#7、配置文件加载位置" class="headerlink" title="7、配置文件加载位置"></a>7、配置文件加载位置</h3><p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%8A%A0%E8%BD%BD%E4%BD%8D%E7%BD%AE.png" alt=""></p>
<p><strong>注意</strong>：他们之间是互补配置</p>
<p>​        <strong>修改默认的路径配置</strong>：方法一：使用 spring.context-path=/boot02 ，在路径访问时需要在前面加上/boot02</p>
<p>​                                            方法二：使用spring.config.location=/home/glh/ideaproject/application.properties 改变默认的配置文件位置</p>
<p>​        <strong>指定的配置文件和默认加载的这些配置文件共同起作用形成互补配置；</strong></p>
<h3 id="8、外部配置加载顺序-下面列举主要了解的"><a href="#8、外部配置加载顺序-下面列举主要了解的" class="headerlink" title="8、外部配置加载顺序(下面列举主要了解的)"></a>8、外部配置加载顺序(下面列举主要了解的)</h3><p>​                <strong>相同内容高优先级覆盖低优先级，但是不同内容之间形成互补配置</strong></p>
<p>１．命令行参数</p>
<!--例如：java -jar xxxx.jar --server.port=8088 --server.context-path=boot2   //访问地址:http://localhost:8088/boot2/hello，多个配置用空格分开-->

<p>２．来自java:comp/env的JNDI属性</p>
<p>３． Java系统属性（System.getProperties() ）</p>
<p>４．操作系统环境变量</p>
<p>5．RandomValuePropertySource配置的random.*属性值</p>
<!--[由jar包外向jar包内进行寻找]-->

<!--（优先加载带profile的）-->

<p><strong>6．jar 包外部的application-{profile}.properties或者application.yml(带spring.profile)配置文件</strong></p>
<p><strong>7．jar 包内部的application-{profile}.properties或者application.yml(带spring.profile)配置文件</strong></p>
<!--(再来加载不带profile的)-->

<p><strong>8．jar 包外部的application.properties或者application.yml(不带spring.profile)配置文件</strong></p>
<p><strong>9．jar 包内部的application.properties或者application.yml(不带spring.profile)配置文件</strong></p>
<p>10．@Configuration注解类上的@PropertySource</p>
<ol start="11">
<li>通过SpringApplication.setDefaultProperties指定的默认属性</li>
</ol>
<p><strong>官网介绍地址</strong>：<a href="https://docs.spring.io/spring-boot/docs/2.2.4.RELEASE/reference/html/spring-boot-features.html#boot-features-profiles" target="_blank" rel="noopener" title="2.Externalized Configuration">链接</a> </p>
<h3 id="9、动配置原理"><a href="#9、动配置原理" class="headerlink" title="9、动配置原理"></a>9、动配置原理</h3><p>配置文件到底能写什么？怎么写？</p>
<p><a href="/home/glh/IdeaProjects/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.2.RELEASE/spring-boot-autoconfigure-2.2.2.RELEASE.jar!/META-INF/spring-configuration-metadata.json">自动配置原理参照</a></p>
<p><a href="https://docs.spring.io/spring-boot/docs/2.2.4.RELEASE/reference/html/appendix-configuration-metadata.html#configuration-metadata-format" target="_blank" rel="noopener">官网链接</a></p>
<p><strong>自动配置原理：</strong></p>
<p>１）、SpringBoot 启动的时候加载主配置类，开启了自动配置功能@EnableAutoConfiguration</p>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/%E8%87%AA%E5%8A%A8%E9%85%8D%E7%BD%AE%EF%BC%91.png" alt=""></p>
<p>２）、@EnableAutoConfiguration作用：</p>
<pre><code>        - 利用EnableAutoConfigurationSelector给容器中导入一些组件;
        - 可以查看getAutoConfigurationEntry()方法的内容;</code></pre><p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/%E8%87%AA%E5%8A%A8%E9%85%8D%E7%BD%AE%EF%BC%92.png" alt=""></p>
<ul>
<li>扫描所有jar包类路径下：META-INF/spring.factories，把扫描到的这些文件的内容包装成properties对象，从properties中获取到 EnableAutoConfiguration.class类（类名）对应的值，然后把他们添加在容器中。</li>
</ul>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/%E8%87%AA%E5%8A%A8%E9%85%8D%E7%BD%AE%EF%BC%93.png" alt=""></p>
<p><strong><em>就是将类路径META-INF/spring.factories　里面配置的所有EnableAutoConfiguration的值加入到容器中</em></strong>（注意：不是所有的这个路径下的spring.factories文件里面都有EnableAutoConfiguration这个变量）</p>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/%E8%87%AA%E5%8A%A8%E9%85%8D%E7%BD%AE%EF%BC%94.png" alt=""></p>
<p>每一个这样的xxxAutoConfiguration类都是容器中的一个组件，都加入到容器当中，用他们做自动配置；</p>
<p>３）、每一个自动配置类进行自动配置功能；</p>
<p>４）、以<strong>HttpEncodingAutoConfiguration(Http编码自动配置)</strong>为例解释一下自动配置原理</p>
<pre class="line-numbers language-java"><code class="language-java"><span class="token comment" spellcheck="true">//表示这是一个配置类，给容器中添加组件</span>
<span class="token annotation punctuation">@Configuration</span><span class="token punctuation">(</span>
    proxyBeanMethods <span class="token operator">=</span> <span class="token boolean">false</span>
<span class="token punctuation">)</span>
<span class="token comment" spellcheck="true">//启用指定类中的ConfigurationProperties功能；将配置文件对应的值和HttpProperties绑定起来；并把HttpProperties加入到ioc容器当中；</span>
<span class="token annotation punctuation">@EnableConfigurationProperties</span><span class="token punctuation">(</span><span class="token punctuation">{</span>HttpProperties<span class="token punctuation">.</span><span class="token keyword">class</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment" spellcheck="true">//Spring底层@Conditional注解，根据不同的条件，如果满足指定的条件，整个配置类里面的配置就会生效；判断是否是web应用，是就生效</span>
<span class="token annotation punctuation">@ConditionalOnWebApplication</span><span class="token punctuation">(</span>
    type <span class="token operator">=</span> Type<span class="token punctuation">.</span>SERVLET
<span class="token punctuation">)</span>
<span class="token comment" spellcheck="true">//判断当前项目是否存在CharacterEncodingFilter类（SpringMVC中进行乱码解决的过滤器）</span>
<span class="token annotation punctuation">@ConditionalOnClass</span><span class="token punctuation">(</span><span class="token punctuation">{</span>CharacterEncodingFilter<span class="token punctuation">.</span><span class="token keyword">class</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment" spellcheck="true">//判断胚子文件中是否存在spring.http.encoding.enabled配置，matchIfMissing表示就算是不存在，判断也是生效的，即使我们配置文件中不配置spring.http.encoding.enabled＝true，也是默认生效的。</span>
<span class="token annotation punctuation">@ConditionalOnProperty</span><span class="token punctuation">(</span>
    prefix <span class="token operator">=</span> <span class="token string">"spring.http.encoding"</span><span class="token punctuation">,</span>
    value <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token string">"enabled"</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
    matchIfMissing <span class="token operator">=</span> <span class="token boolean">true</span>
<span class="token punctuation">)</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">HttpEncodingAutoConfiguration</span> <span class="token punctuation">{</span>
    <span class="token comment" spellcheck="true">//这个和SpringBoot的配置文件映射了</span>
     <span class="token keyword">private</span> <span class="token keyword">final</span> Encoding properties<span class="token punctuation">;</span>

    <span class="token comment" spellcheck="true">//只有一个有参构造器的情况下，参数的值就会从容器中拿</span>
    <span class="token keyword">public</span> <span class="token function">HttpEncodingAutoConfiguration</span><span class="token punctuation">(</span>HttpProperties properties<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>properties <span class="token operator">=</span> properties<span class="token punctuation">.</span><span class="token function">getEncoding</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token annotation punctuation">@Bean</span>　<span class="token comment" spellcheck="true">//给容器添加一个组件，这个组件的某些值需要从properties中获取</span>
    <span class="token annotation punctuation">@ConditionalOnMissingBean</span>
    <span class="token keyword">public</span> CharacterEncodingFilter <span class="token function">characterEncodingFilter</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        CharacterEncodingFilter filter <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">OrderedCharacterEncodingFilter</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        filter<span class="token punctuation">.</span><span class="token function">setEncoding</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>properties<span class="token punctuation">.</span><span class="token function">getCharset</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        filter<span class="token punctuation">.</span><span class="token function">setForceRequestEncoding</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>properties<span class="token punctuation">.</span><span class="token function">shouldForce</span><span class="token punctuation">(</span>org<span class="token punctuation">.</span>springframework<span class="token punctuation">.</span>boot<span class="token punctuation">.</span>autoconfigure<span class="token punctuation">.</span>http<span class="token punctuation">.</span>HttpProperties<span class="token punctuation">.</span>Encoding<span class="token punctuation">.</span>Type<span class="token punctuation">.</span>REQUEST<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        filter<span class="token punctuation">.</span><span class="token function">setForceResponseEncoding</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>properties<span class="token punctuation">.</span><span class="token function">shouldForce</span><span class="token punctuation">(</span>org<span class="token punctuation">.</span>springframework<span class="token punctuation">.</span>boot<span class="token punctuation">.</span>autoconfigure<span class="token punctuation">.</span>http<span class="token punctuation">.</span>HttpProperties<span class="token punctuation">.</span>Encoding<span class="token punctuation">.</span>Type<span class="token punctuation">.</span>RESPONSE<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> filter<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>根据当前不同的条件进行判断，决定这个配置是否生效？</p>
<p>一旦这个配置类生效，这个配置类就会给容器中添加各种组件；这些组件的属性是从对应的properties类中获取的，这些类里面的每一个属性又是和配置文件绑定的。</p>
<p>５）、所有在配置文件中能配置的属性都是在xxxProperties类中封装着；配置文件能配置什么就可以参照某个功能对应的属性类</p>
<pre class="line-numbers language-java"><code class="language-java"><span class="token comment" spellcheck="true">//从配置文件中获取指定的值和bean的属性进行绑定</span>
<span class="token annotation punctuation">@ConfigurationProperties</span><span class="token punctuation">(</span>
    prefix <span class="token operator">=</span> <span class="token string">"spring.http"</span>
<span class="token punctuation">)</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">HttpProperties</span> <span class="token punctuation">{</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>６）、总结</p>
<p>​    a)、Spring Boot启动会加载大量的自动配置类</p>
<p>​    b)、我们看我们需要的功能有没有SpringBoot默认写好的自动配置类；</p>
<p>​    c)、我们再来看这个自动配置类中到底配置了哪些组件；（只要我们需要的组件有，我们就不需要再来配置了）</p>
<p>​    d)、给容器中自动配置类添加组件的时候，会从properties类中获取某些属性，我们就可以在配置文件中指定这些属性的值；</p>
<h3 id="10、Conditional"><a href="#10、Conditional" class="headerlink" title="10、Conditional"></a>10、Conditional</h3><p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/@Conditional%E6%89%A9%E5%B1%95.png" alt=""></p>
<p><strong>自动配置类必须在一定的条件下才能生效</strong></p>
<p><strong>怎么才能知道自动配置类生效</strong>：我们可以通过启用　debug=true 属性，来让控制台打印自动配置报告，这样我们就能很方便知道哪些自动配置类生效了；</p>
<pre class="line-numbers language-yaml"><code class="language-yaml"><span class="token key atrule">server</span><span class="token punctuation">:</span>
  <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8081</span>
<span class="token key atrule">spring</span><span class="token punctuation">:</span>
  <span class="token key atrule">profiles</span><span class="token punctuation">:</span>
    <span class="token key atrule">active</span><span class="token punctuation">:</span> prod
<span class="token key atrule">debug</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
<span class="token punctuation">---</span>
<span class="token key atrule">server</span><span class="token punctuation">:</span>
  <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8082</span>
<span class="token key atrule">spring</span><span class="token punctuation">:</span>
  <span class="token key atrule">profiles</span><span class="token punctuation">:</span> dev
<span class="token punctuation">---</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<pre class="line-numbers language-java"><code class="language-java"><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span>
CONDITIONS EVALUATION REPORT
<span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span>

Positive matches<span class="token operator">:</span> <span class="token comment" spellcheck="true">//这是匹配到的</span>
<span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">-</span>

   AopAutoConfiguration matched<span class="token operator">:</span>
      <span class="token operator">-</span> <span class="token annotation punctuation">@ConditionalOnProperty</span> <span class="token punctuation">(</span>spring<span class="token punctuation">.</span>aop<span class="token punctuation">.</span>auto<span class="token operator">=</span><span class="token boolean">true</span><span class="token punctuation">)</span> <span class="token function">matched</span> <span class="token punctuation">(</span>OnPropertyCondition<span class="token punctuation">)</span>

   AopAutoConfiguration<span class="token punctuation">.</span>ClassProxyingConfiguration matched<span class="token operator">:</span>
      <span class="token operator">-</span> <span class="token annotation punctuation">@ConditionalOnMissingClass</span> did not find unwanted <span class="token keyword">class</span> <span class="token string">'org.aspectj.weaver.Advice'</span> <span class="token punctuation">(</span>OnClassCondition<span class="token punctuation">)</span>
      <span class="token operator">-</span> <span class="token annotation punctuation">@ConditionalOnProperty</span> <span class="token punctuation">(</span>spring<span class="token punctuation">.</span>aop<span class="token punctuation">.</span>proxy<span class="token operator">-</span>target<span class="token operator">-</span><span class="token keyword">class</span><span class="token operator">=</span><span class="token boolean">true</span><span class="token punctuation">)</span> <span class="token function">matched</span> <span class="token punctuation">(</span>OnPropertyCondition<span class="token punctuation">)</span>

   DispatcherServletAutoConfiguration matched<span class="token operator">:</span>
      <span class="token operator">-</span> <span class="token annotation punctuation">@ConditionalOnClass</span> found required <span class="token keyword">class</span> <span class="token string">'org.springframework.web.servlet.DispatcherServlet'</span> <span class="token punctuation">(</span>OnClassCondition<span class="token punctuation">)</span>
      <span class="token operator">-</span> found <span class="token string">'session'</span> <span class="token function">scope</span> <span class="token punctuation">(</span>OnWebApplicationCondition<span class="token punctuation">)</span>

   DispatcherServletAutoConfiguration<span class="token punctuation">.</span>DispatcherServletConfiguration matched<span class="token operator">:</span>
      <span class="token operator">-</span> <span class="token annotation punctuation">@ConditionalOnClass</span> found required <span class="token keyword">class</span> <span class="token string">'javax.servlet.ServletRegistration'</span> <span class="token punctuation">(</span>OnClassCondition<span class="token punctuation">)</span>
      <span class="token operator">-</span> Default DispatcherServlet did not find dispatcher servlet <span class="token function">beans</span> <span class="token punctuation">(</span>DispatcherServletAutoConfiguration<span class="token punctuation">.</span>DefaultDispatcherServletCondition<span class="token punctuation">)</span>

Negative matches<span class="token operator">:</span>　　<span class="token comment" spellcheck="true">//这是未匹配的</span>
<span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">-</span>

   ActiveMQAutoConfiguration<span class="token operator">:</span>
      Did not match<span class="token operator">:</span>
         <span class="token operator">-</span> <span class="token annotation punctuation">@ConditionalOnClass</span> did not find required <span class="token keyword">class</span> <span class="token string">'javax.jms.ConnectionFactory'</span> <span class="token punctuation">(</span>OnClassCondition<span class="token punctuation">)</span>

   AopAutoConfiguration<span class="token punctuation">.</span>AspectJAutoProxyingConfiguration<span class="token operator">:</span>
      Did not match<span class="token operator">:</span>
         <span class="token operator">-</span> <span class="token annotation punctuation">@ConditionalOnClass</span> did not find required <span class="token keyword">class</span> <span class="token string">'org.aspectj.weaver.Advice'</span> <span class="token punctuation">(</span>OnClassCondition<span class="token punctuation">)</span>

   ArtemisAutoConfiguration<span class="token operator">:</span>
      Did not match<span class="token operator">:</span>
         <span class="token operator">-</span> <span class="token annotation punctuation">@ConditionalOnClass</span> did not find required <span class="token keyword">class</span> <span class="token string">'javax.jms.ConnectionFactory'</span> <span class="token punctuation">(</span>OnClassCondition<span class="token punctuation">)</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h3 id="11、banner更换"><a href="#11、banner更换" class="headerlink" title="11、banner更换"></a>11、banner更换</h3><p>有没有觉得原始的banner不太好看</p>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/springboot03.png" alt=""></p>
<p>那么我们在resources下新建一个banner.txt文件</p>
<pre class="line-numbers language-txt"><code class="language-txt">${AnsiColor.BRIGHT_YELLOW}
////////////////////////////////////////////////////////////////////
//                          _ooOoo_                               //
//                         o8888888o                              //
//                         88" . "88                              //
//                         (| ^_^ |)                              //
//                         O\  =  /O                              //
//                      ____/`---'\____                           //
//                    .'  \\|     |//  `.                         //
//                   /  \\|||  :  |||//  \                        //
//                  /  _||||| -:- |||||-  \                       //
//                  |   | \\\  -  /// |   |                       //
//                  | \_|  ''\---/''  |   |                       //
//                  \  .-\__  `-`  ___/-. /                       //
//                ___`. .'  /--.--\  `. . ___                     //
//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
//      ========`-.____`-.___\_____/___.-`____.-'========         //
//                           `=---='                              //
//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
//             佛祖保佑       永不宕机     永无BUG                  //
////////////////////////////////////////////////////////////////////
${AnsiColor.BRIGHT_RED}
Application Version: ${application.version}${application.formatted-version}
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<ul>
<li><p>${AnsiColor.BRIGHT_RED}：设置控制台中输出内容的颜色，可以自定义，具体参<code>org.springframework.boot.ansi.AnsiColor</code></p>
</li>
<li><p>${application.version}：用来获取MANIFEST.MF文件中的版本号，这就是为什么要在Application.java中指定 SpringVersion.class</p>
</li>
<li><p>{application.formatted-version}：格式化后的{application.version}版本信息</p>
</li>
<li><p>${spring-boot.version}：Spring Boot的版本号</p>
</li>
<li><p>{spring-boot.formatted-version}：格式化后的{spring-boot.version}版本信息</p>
</li>
</ul>
<p>启动之后，</p>
<p><img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/springboot04.png" alt=""></p>

            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/blog/about" rel="external nofollow noreferrer">glh</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://blog.glh508.top/blog/post/6ae47735.html">https://blog.glh508.top/blog/post/6ae47735.html</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/blog/about" target="_blank">glh</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/blog/tags/SpringBoot/">
                                    <span class="chip bg-color">SpringBoot</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/blog/libs/share/css/share.min.css">
<div id="article-share">

    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="" data-original="/blog/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="" data-original="/blog/medias/reward/wechat.png" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>

            
        </div>
    </div>

    

    

    

    

    
        <style>
    .valine-card {
        margin: 1.5rem auto;
    }

    .valine-card .card-content {
        padding: 20px 20px 5px 20px;
    }

    #vcomments textarea {
        box-sizing: border-box;
        background: url("/blog/medias/comment_bg.png") 100% 100% no-repeat;
    }

    #vcomments p {
        margin: 2px 2px 10px;
        font-size: 1.05rem;
        line-height: 1.78rem;
    }

    #vcomments blockquote p {
        text-indent: 0.2rem;
    }

    #vcomments a {
        padding: 0 2px;
        color: #4cbf30;
        font-weight: 500;
        text-decoration: none;
    }

    #vcomments img {
        max-width: 100%;
        height: auto;
        cursor: pointer;
    }

    #vcomments ol li {
        list-style-type: decimal;
    }

    #vcomments ol,
    ul {
        display: block;
        padding-left: 2em;
        word-spacing: 0.05rem;
    }

    #vcomments ul li,
    ol li {
        display: list-item;
        line-height: 1.8rem;
        font-size: 1rem;
    }

    #vcomments ul li {
        list-style-type: disc;
    }

    #vcomments ul ul li {
        list-style-type: circle;
    }

    #vcomments table, th, td {
        padding: 12px 13px;
        border: 1px solid #dfe2e5;
    }

    #vcomments table, th, td {
        border: 0;
    }

    table tr:nth-child(2n), thead {
        background-color: #fafafa;
    }

    #vcomments table th {
        background-color: #f2f2f2;
        min-width: 80px;
    }

    #vcomments table td {
        min-width: 80px;
    }

    #vcomments h1 {
        font-size: 1.85rem;
        font-weight: bold;
        line-height: 2.2rem;
    }

    #vcomments h2 {
        font-size: 1.65rem;
        font-weight: bold;
        line-height: 1.9rem;
    }

    #vcomments h3 {
        font-size: 1.45rem;
        font-weight: bold;
        line-height: 1.7rem;
    }

    #vcomments h4 {
        font-size: 1.25rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    #vcomments h5 {
        font-size: 1.1rem;
        font-weight: bold;
        line-height: 1.4rem;
    }

    #vcomments h6 {
        font-size: 1rem;
        line-height: 1.3rem;
    }

    #vcomments p {
        font-size: 1rem;
        line-height: 1.5rem;
    }

    #vcomments hr {
        margin: 12px 0;
        border: 0;
        border-top: 1px solid #ccc;
    }

    #vcomments blockquote {
        margin: 15px 0;
        border-left: 5px solid #42b983;
        padding: 1rem 0.8rem 0.3rem 0.8rem;
        color: #666;
        background-color: rgba(66, 185, 131, .1);
    }

    #vcomments pre {
        font-family: monospace, monospace;
        padding: 1.2em;
        margin: .5em 0;
        background: #272822;
        overflow: auto;
        border-radius: 0.3em;
        tab-size: 4;
    }

    #vcomments code {
        font-family: monospace, monospace;
        padding: 1px 3px;
        font-size: 0.92rem;
        color: #e96900;
        background-color: #f8f8f8;
        border-radius: 2px;
    }

    #vcomments pre code {
        font-family: monospace, monospace;
        padding: 0;
        color: #e8eaf6;
        background-color: #272822;
    }

    #vcomments pre[class*="language-"] {
        padding: 1.2em;
        margin: .5em 0;
    }

    #vcomments code[class*="language-"],
    pre[class*="language-"] {
        color: #e8eaf6;
    }

    #vcomments [type="checkbox"]:not(:checked), [type="checkbox"]:checked {
        position: inherit;
        margin-left: -1.3rem;
        margin-right: 0.4rem;
        margin-top: -1px;
        vertical-align: middle;
        left: unset;
        visibility: visible;
    }

    #vcomments b,
    strong {
        font-weight: bold;
    }

    #vcomments dfn {
        font-style: italic;
    }

    #vcomments small {
        font-size: 85%;
    }

    #vcomments cite {
        font-style: normal;
    }

    #vcomments mark {
        background-color: #fcf8e3;
        padding: .2em;
    }

    #vcomments table, th, td {
        padding: 12px 13px;
        border: 1px solid #dfe2e5;
    }

    table tr:nth-child(2n), thead {
        background-color: #fafafa;
    }

    #vcomments table th {
        background-color: #f2f2f2;
        min-width: 80px;
    }

    #vcomments table td {
        min-width: 80px;
    }

    #vcomments [type="checkbox"]:not(:checked), [type="checkbox"]:checked {
        position: inherit;
        margin-left: -1.3rem;
        margin-right: 0.4rem;
        margin-top: -1px;
        vertical-align: middle;
        left: unset;
        visibility: visible;
    }
</style>

<div class="card valine-card" data-aos="fade-up">
    <div class="comment_headling" style="font-size: 20px; font-weight: 700; position: relative; padding-left: 20px; top: 15px; padding-bottom: 5px;">
        <i class="fas fa-comments fa-fw" aria-hidden="true"></i>
        <span>评论</span>
    </div>
    <div id="vcomments" class="card-content" style="display: grid">
    </div>
</div>

<script src="/blog/libs/valine/av-min.js"></script>
<script src="https://sky508.gitee.io/blog/libs/valine/Valine.min.js"></script>
<script>
    new Valine({
        el: '#vcomments',
        appId: 't5C6WwDat4msTdtyG9E8lSU7-gzGzoHsz',
        appKey: 'xE7bK8SjGw38UDPb7vLi5qsb',
        notify: 'true' === 'true',
        verify: 'true' === 'true',
        visitor: 'true' === 'true',
        avatar: 'mm',
        pageSize: '10',
        lang: 'zh-cn',
        placeholder: '欢迎留下您的讨论'
    });
</script>

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/blog/post/2c96e6e6.html">
                    <div class="card-image">
                        
                        
                        <img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/2.jpg" class="responsive-img" alt="搭建个人的ngrok服务器">
                        
                        <span class="card-title">搭建个人的ngrok服务器</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            忙活了大半天，终于成功的搭建好了，并且可用，就是所处环境网速限制，体验感不强。在此记录一下过程出现的问题及解决方法，仅供参考。附上以为大佬的ngrok的安装教程http://www.sunnyos.com/article-show-48.h
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2020-02-16
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/blog/categories/%E6%8A%80%E5%B7%A7%E4%BB%8B%E7%BB%8D/" class="post-category">
                                    技巧介绍
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/blog/tags/ngrok/">
                        <span class="chip bg-color">ngrok</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/blog/post/9adc8b84.html">
                    <div class="card-image">
                        
                        
                        <img src="" data-original="https://glh508-blog-img.oss-cn-beijing.aliyuncs.com/img/14.jpg" class="responsive-img" alt="SpringBoot+thymeleaf+shiro整合小总结">
                        
                        <span class="card-title">SpringBoot+thymeleaf+shiro整合小总结</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            首先确保在不进行shiro整合时正常登录以及拥有权限，然后我们再开始，以下是我个人的思路。首先，准备依赖（这里只讲关键依赖，目前我就用到了这些，够用就行，也别把相关依赖全部弄进来）：
&lt;!--shiro依赖-->
        &l
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-02-12
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/blog/categories/%E5%90%8E%E7%AB%AF%E6%A1%86%E6%9E%B6/" class="post-category">
                                    后端框架
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/blog/tags/SpringBoot/">
                        <span class="chip bg-color">SpringBoot</span>
                    </a>
                    
                    <a href="/blog/tags/shiro/">
                        <span class="chip bg-color">shiro</span>
                    </a>
                    
                    <a href="/blog/tags/thymeleaf/">
                        <span class="chip bg-color">thymeleaf</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/blog/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/blog/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/blog/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/blog/libs/codeBlock/codeShrink.js"></script>


<!-- 代码块折行 -->

<style type="text/css">
code[class*="language-"], pre[class*="language-"] { white-space: pre !important; }
</style>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="https://sky508.gitee.io/blog/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
    <div class="container row center-align" style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            <span id="year">2019</span>
            <a href="/blog/about" target="_blank">glh</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/sky508/blog.git" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:17730269920@163.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=978742791" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 978742791" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







</div>
    </div>
</footer>



    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/blog/js/search.js"></script>
<script type="text/javascript">
$(function () {
    searchFunc("/blog/search.xml", 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="https://sky508.gitee.io/blog/libs/materialize/materialize.min.js"></script>
    <script src="https://sky508.gitee.io/blog/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="https://sky508.gitee.io/blog/libs/aos/aos.js"></script>
    <script src="https://sky508.gitee.io/blog/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="https://sky508.gitee.io/blog/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/blog/js/matery.js"></script>

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

    
    <script src="https://sky508.gitee.io/blog/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="https://sky508.gitee.io/blog/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    

    

    

    
    <script src="https://sky508.gitee.io/blog/libs/instantpage/instantpage.js" type="module"></script>
    

<script>
            window.imageLazyLoadSetting = {
                isSPA: false,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(n){n.imageLazyLoadSetting.processImages=o;var i=n.imageLazyLoadSetting.isSPA,r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]"));function o(){i&&(r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")));for(var t,e,a=0;a<r.length;a++)t=r[a],0<=(e=t.getBoundingClientRect()).bottom&&0<=e.left&&e.top<=(n.innerHeight||document.documentElement.clientHeight)&&function(){var t,e,n,i,o=r[a];t=o,e=function(){r=r.filter(function(t){return o!==t})},n=new Image,i=t.getAttribute("data-original"),n.onload=function(){t.src=i,e&&e()},n.src=i}()}o(),n.addEventListener("scroll",function(){var t,e;t=o,e=n,clearTimeout(t.tId),t.tId=setTimeout(function(){t.call(e)},500)})}(this);</script></body>

</html>
